﻿#define SIL_SIM_BASE_MF4_FILE

#include <cstdint>
#include <vector>

#include "RecorderIF.h"
#include "Demo/AlgorithmIF.h"

inline static void createMeasurement(const std::string& deviceName, const uint64_t address, const std::string& observeSignalName, const Mf4Recorder::SignalBaseInfo::TYPE type,
									 const double factor, const double offset, const std::string& unit,
									 std::vector<Mf4Recorder::SignalBaseInfo>& signalBaseInfo)
{
	Mf4Recorder::SignalBaseInfo temp;

	temp.deviceName = deviceName;
	temp.address = address;
	temp.name = observeSignalName;
	temp.type = type;

	temp.factor = factor;
	temp.offset = offset;
	temp.unit = unit;

	signalBaseInfo.emplace_back(temp);
}

inline static void createMeasurement(const std::string& deviceName, const uint64_t address, const std::string& observeSignalName, const Mf4Recorder::SignalBaseInfo::TYPE type,
									 const double factor, const double offset, const std::string& unit,
									 const std::vector<Mf4Recorder::SignalBaseInfo::EnumKeyValue>& enumKeyValue, std::vector<Mf4Recorder::SignalBaseInfo>& signalBaseInfo)
{
	createMeasurement(deviceName, address, observeSignalName, type, factor, offset, unit, signalBaseInfo);

	signalBaseInfo.back().enumKeyValue = enumKeyValue;
}


void addSignal_Algorithm_Algorithm(std::vector<Mf4Recorder::SignalBaseInfo>& signalBaseInfo)
{
	createMeasurement("Algorithm_Algorithm",
					 (uint64_t)&Algorithm::AlgorithmRunCounter,
					 "AlgorithmRunCounter",
					 Mf4Recorder::SignalBaseInfo::TYPE::U64, 1.0, 0.0, std::string(), signalBaseInfo);

	createMeasurement("Algorithm_Algorithm",
					 (uint64_t)&Algorithm::AlgorithmRunTime,
					 "AlgorithmRunTime",
					 Mf4Recorder::SignalBaseInfo::TYPE::U32, 1.0, 0.0, std::string(), signalBaseInfo);

	createMeasurement("Algorithm_Algorithm",
					 (uint64_t)&Algorithm::ins_CalcDistance.distance_,
					 "ins_CalcDistance.distance_",
					 Mf4Recorder::SignalBaseInfo::TYPE::F32, 1.0, 0.0, std::string(), signalBaseInfo);

}
